define("router", [], (require, exports, module) => {
	exports.done = (store, progress) => {
		$.router({
			"/dplus": function(e, args){
				console.log(args);
				typeof dplus_Click !== "undefined" && dplus_Click(args.handle, args);
			},
			"/toggleMenu": function(e, args) {
				var a = $.query(this)[0]._next();
				a[a._hasClass("hide") ? "_removeClass" : "_addClass"]("hide");
			},
			"/menu": function(e, args) {
				console.log(args.t);
				$.query(".menutitle")[0]._html(args.t);
				$.query(this)[0]._parents("ul")._removeClass("hide")._addClass("hide");
			},
			"/goTo": function(e, args) {
				console.log(args.u);
				$.router("/linkProgress?d="+store.get("state").dplus[args.d]+"&u="+args.u);
			},
			"/gotop": function(e, args) {
				window.scrollTo(1, 1);
			},
			"/linkProgress": function(e, args){
				progress.end();
				progress.start(() => {
					console.log("dplus end! "+args.d);
				}, () => {
					location.href = args.u;
				});
				$.query(document)[0]._off("unload")._on("unload", function(){
					progress.end(() => {
						progress.destroy();
					});
				});
			}
		});
	};
});